using Fusion.Utilities.Singleton;
using System.Collections.Generic;

namespace Fusion.Net
{
    public class NetManager : SingletonBehaviour<NetManager>
    {
        private List<NetBase> nets = new List<NetBase>();

        public void Remove(NetBase net)
        {
            nets.Remove(net);
        }

        public void Add(NetBase net)
        {
            nets.Add(net);
        }

        public void Clear()
        {
            for (int index = nets.Count - 1; index >= 0; index--)
            {
                nets[index].Close();
            }
        }

        private void OnApplicationQuit()
        {
            Clear();
        }
    }
}

